<include file="header" />
<link rel="stylesheet" href="/assets/bower_components/sweetalert/lib/sweet-alert.css">
</head>
<body>
<div class="wraper">
    <div class="load">
        <img class="load-bee" src="/assets/base/carreserve/images/load-bee.png">
    </div>
	<div class="head clearfix">
		<a href="javascript:history.go(-1);" class="iconfont icon-zuo pull-left"></a>
		<span class="head-name pull-left">预约详情</span>
		<a href="/base/carReserve/index/car_id/{BEESCRM:$car_id}" class="pull-left text-right iconfont icon-shouye"></a>
	</div>
	<div class="block-space">
		<div class="lists">
			<div class="form-list tb-mode">
				<p class="tb-cell field">订单状态</p>
				<if condition="$data['status'] eq 0">
					<p class="tb-cell"><span class="information text-red">待支付</span></p>
				</if>

				<if condition="$data['status'] eq 1">
					<p class="tb-cell"><span class="information text-green">已支付</span></p>
				</if>

				<if condition="$data['status'] eq 5">
					<p class="tb-cell"><span class="information text-grey">已取消</span></p>
				</if>

				<if condition="$data['status'] eq 2">
					<p class="tb-cell"><span class="information text-green">预约成功</span></p>
				</if>

				<if condition="$data['status'] eq 3">
					<p class="tb-cell"><span class="information text-red">预约失败，已退款</span></p>
				</if>

				<if condition="$data['status'] eq 6">
					<p class="tb-cell"><span class="information text-red">已关闭</span></p>
				</if>

			</div>
			<div class="form-list tb-mode">
				<p class="tb-cell field">下单时间</p>
				<p class="tb-cell"><span class="information">{BEESCRM:$data.create_time|date="Y-m-d H:i",###}</span></p>
			</div>
			<div class="form-list tb-mode">
				<p class="tb-cell field">订单编号</p>
				<p class="tb-cell"><span class="information">{BEESCRM:$data.order_sn}</span></p>
			</div>
		</div>
		<div class="contain">
			<div class="ticket">
				<p class="strong">{BEESCRM:$data.start_address} <span class="iconfont icon-arrowgo"></span> {BEESCRM:$data.end_address}</p>
				<p>发车时间：{BEESCRM:$data.send_time|date="Y-m-d H:i",###}</p>
				<p>发车地点：{BEESCRM:$data.start_address}</p>
			</div>
			<div class="wave-rown"></div>
			<div class="block-space">
				<div class="tb-mode margin-b">
					<p class="tb-cell">数量： <span class="price">1</span></p>
					<p class="tb-cell text-right">总价：<span class="price">￥{BEESCRM:$data.goods_amount}元 / 人</span></p>
				</div>
			</div>
		</div>
		<div class="lists">
			<div class="form-list tb-mode">
				<p class="tb-cell field">预约姓名</p>
				<p class="tb-cell"><span class="information">{BEESCRM:$data.username}</span></p>
			</div>
			<div class="form-list tb-mode">
				<p class="tb-cell field">联系方式</p>
				<p class="tb-cell"><span class="information">{BEESCRM:$data.mobile}</span></p>
			</div>
			<div class="form-list tb-mode">
				<p class="tb-cell field">身份证号</p>
				<p class="tb-cell"><span class="information">{BEESCRM:$data.card_num}</span></p>
			</div>
		</div>
		<input type="hidden" value="{BEESCRM:$car_id}" id="car_id">
		<!--预约成功-->
		<if condition="$data['message_id'] gt 0 && $data['status'] eq 2 && $data['shift_id'] gt 0">
		<div class="lists">
			<div class="form-list tb-mode">
				<p class="tb-cell field">车辆信息</p>
				<p class="tb-cell"><span class="information">{BEESCRM:$data.car_number}</span></p>
			</div>
			<div class="form-list tb-mode">
				<p class="tb-cell field">座位号码</p>
				<p class="tb-cell"><span class="information">{BEESCRM:$data.seat}</span></p>
			</div>
			<div class="form-list tb-mode">
				<p class="tb-cell field">注意事项</p>
				<p class="tb-cell"><span class="information"><if condition="$data.memo">{BEESCRM:$data.memo}<else/>暂无</if></span></p>
			</div>
		</div>
		</if>
		<!--预约失败-->
		<if condition="$data['message_id'] gt 0 && ($data['status'] eq 3 || $data['status'] eq 4)">
			<div class="lists">
				<p>原因解释</p>
				<p class="font12">{BEESCRM:$data.reason}</p>
			</div>
		</if>
	</div>
	<div class="fixed-box">
		<!--未支付-->
		<!--<if condition="$data['status'] eq 0">
			<div class="clearfix">
				<a href="javascript:void(0);" class="btn half btn-brown cancel_order" data-id="{BEESCRM:$data.order_id}">取消订单</a>
				<a href="/base/?m=carReserve&a=repay&order_id={BEESCRM:$data.order_id}&car_id={BEESCRM:$car_id}" class="btn half">立即支付</a>
			</div>
		</if>-->

		<!--已支付-->
		<if condition="$data['status'] eq 1">
			<a href="javascript:void(0);" class="btn btn-brown cancel_order" data-id="{BEESCRM:$data.sub_order_id}">取消预约</a>
		</if>
		<!--已取消-->
		<if condition="$data['status'] eq 5 || $data['status'] eq 6">
			<a href="/base/carReserve/index/car_id/{BEESCRM:$car_id}" class="btn btn-brown">返回首页</a>
		</if>
		<div class="rule clearfix">
			<p class="rule-title">—— 包车进度 ——</p>
			<div class="step">
				<p class="iconfont icon-1 text-green"></p>
				<p>选择路线</p>
			</div>
			<div class="step">
				<p class="iconfont icon-2 <if condition="in_array($data['status'],array(1,2,3,4))">text-green</if>"></p>
				<p>预约支付</p>
			</div>

			<!--已支付-->
			<div class="step">
				<p class="iconfont icon-3 <if condition="in_array($data['status'],array(1,2,3,4))">text-green</if>"></p>
				<p>等待成团</p>
			</div>

			<!--已取消-->
			<if condition="in_array($data['status'],array(3,4,5))">
				<div class="step">
					<p class="iconfont icon-4 text-green"></p>
					<p>包车失败</p>
				</div>
			</if>
			<!--预约成功-->
			<if condition="in_array($data['status'],array(0,1,2))">
				<div class="step">
					<p class="iconfont icon-4 <if condition="$data['status'] eq 2">text-green</if>"></p>
					<p>包车成功</p>
				</div>
			</if>
		</div>
	</div>
</div>
</body>
<script src="/assets/base/carreserve/js/jquery-2.1.0.min.js"></script>
<script src="/assets/bower_components/sweetalert/lib/sweet-alert.min.js"></script>
<script src="/assets/base/carreserve/js/jq.utils.js"></script>
<script>
	$(function(){
		var fixed_h = $('.fixed-box').height();
		$('.wraper').css("marginBottom",fixed_h);
	});

	$(window).load(function(){
		$('.load').hide();
	});

	$('.cancel_order').on('click',function(){
		var sub_order_id = $(this).data('id');
		var car_id = $('#car_id').val();
		$.confirm('确认取消预约吗？',cancel);
		function cancel(){
			if(sub_order_id){
				$.ajax({
					'url': "/base/carReserve/cancelOrder/car_id/"+car_id,
					'data': {'sub_order_id':sub_order_id},
					'dataType':'json',
					'type': 'POST',
					'async': false,
					success: function(data) {
						if (data.status == 'S') {
							$.alert('success',data.message);
							setTimeout('location.reload()', 2000);
						}else{
							$.alert('error',data.message);
							return false;
						}
					}
				});
			}
		}
	});
</script>
</html>